package com.paradigmcreatives.game.ui;

import java.lang.reflect.Array;
import java.util.ArrayList;

import com.paradigmcreatives.game.DoodleGameActivity;
import com.paradigmcreatives.game.word.WordGenerator;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.widget.Toast;

public class WordList {

	DoodleGameActivity doodleGameActivity;
	public WordList(DoodleGameActivity doodleGameActivity) {
		this.doodleGameActivity = doodleGameActivity;
	}


	public void showDialog(){

		ArrayList<String> sugges = new WordGenerator(doodleGameActivity).getSuggestionWords(); 
		final String[] suggestions = sugges.toArray(new String[sugges.size()]);

		AlertDialog.Builder builder = new AlertDialog.Builder(doodleGameActivity);
		builder.setTitle("Pick a color");
		builder.setItems(suggestions, new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int item) {
				Toast.makeText(doodleGameActivity, suggestions[item], Toast.LENGTH_SHORT).show();
				doodleGameActivity.uiManager.WordEntered(suggestions[item]);
			}
		});
		AlertDialog alert = builder.create();
		alert.setCancelable(false);
		alert.show();
	}
}
